@section('meta')
    <style>
        body{background-color: #fff;}
        .modal-content{display: unset;}
        .layui-table{width: 97%;margin: 0 auto;}
        .layui-form-select dl {min-width: 86%;}
        .new-table {margin: 20px 0;}
    </style>
@endsection
@include('Home.User.Common._meta')
<!--升职加薪记录-->
<div class="modal-content new-table" id="addNew-content2">
    <div class="layui-form">
        <div class="modal-func-btns">
            <a href="javascript:location.replace(location.href);" class="modal-edit-btn" title="重置"><i class="icon icon-edit"></i></a>
        </div>
        <table class="layui-table">
            <thead>
            <tr>
                <th>序号</th>
                <th>时间</th>
                <th>之前级别</th>
                <th>之前薪资</th>
                <th>当前级别</th>
                <th>当前薪资</th>
                <th> 操作 </th>
            </tr>
            </thead>
            <tbody>
            @foreach($obj->up_salary as $item)
                <tr>
                    <td data-label="序号"> {{$item->id}} </td>
                    <td data-label="时间"> {{$item->created_at}} </td>
                    <td data-label="之前级别"> {{$item->before_rank}} </td>
                    <td data-label="之前薪资"> {{$item->before_salary}} </td>
                    <td data-label="当前级别"> {{$item->now_rank}} </td>
                    <td data-label="当前薪资"> {{$item->now_salary}} </td>
                    <td data-label="操作" class="tac layui-row layui-col-space10">
                        <a href="javascript:;" onclick="del(this,'{{route('hr_promotion',[$obj->id,$item->id])}}')" class="edit-btn">删除</a>
                    </td>
                </tr>
            @endforeach
            </tbody>
        </table>
    </div>

</div>
@section('footer')
    <script>
        function del(obj,url) {
            layer.confirm("你确定删除吗？此操作不能撤销！", {icon: 3, title:'提示'},
                function(index){//确定回调
                    $.ajax({
                        type: 'get',
                        url: url,
                        dataType: 'json',
                        success: function(data){
                            if(data.code){
                                layer.close(index);
                                $(obj).parent().parent().remove();
                            }else{
                                layer.msg(data.msg,{icon: 5,time:1000});
                            }
                        },
                        error:function() {
                            layer.msg('服务器错误!',{icon: 5,time:1000});
                        }
                    });
                },function (index) {//取消回调
                    layer.close(index);
                }
            );
        }
    </script>
@endsection
@include('Home.User.Common._footer')
@include('Home.User.Common._form')